# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer:
pkgname=libm4ri
pkgver=20200125
pkgrel=4
pkgdesc="Library for fast arithmetic with dense matrices over F2"
url="https://github.com/malb/m4ri"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	autoconf
	automake
	libpng-dev
	libtool
	"
source="https://github.com/malb/m4ri/archive/release-$pkgver/m4ri-$pkgver.tar.gz"
subpackages="$pkgname-static $pkgname-dev"
builddir="$srcdir/m4ri-release-$pkgver"

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	export CFLAGS="${CFLAGS/-Os/-O3}" # gotta go fast

	./configure \
		--target="$CTARGET" \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr \
		--enable-thread-safe \
		--enable-openmp
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
220c965c2c65aa96d7a138bdaf987e5649199464804bdf80a41f04f645934a07236cd5667a9752c4491bc3727dba6eda1f17779cdcf93d453374f5d7a4976698  m4ri-20200125.tar.gz
"
